package chapter07

import scala.collection.immutable
import scala.collection.parallel.immutable.ParSeq

/**
  * 并行集合
  */
object Test20_Parallel {
  def main(args: Array[String]): Unit = {
    // 串行
    val result: immutable.IndexedSeq[String] = (1 to 100).map(
      x => Thread.currentThread().getName
    )
    println(result)

    //并行
    val result2: ParSeq[String] = (1 to 100).par.map(
      y => Thread.currentThread().getName
    )
    println(result2)
  }

}
